<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jQuery.min.js"></script>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <script>
        $(function(){
            var sum = 0;
            var arr = ['red','blue','pink']
            $('div').each(function(index,domEle){
                //第一个元素一定是个索引
                // console.log(index);
                // //第二个元素是dom对象
                // console.log(domEle);
                // dom对象没有css方法
                $(domEle).css('color',arr[index])
                sum += parseInt($(domEle).text());
            })
            // console.log(sum);
            // $.each(arr,function(i,domEle){
            //     console.log(arr);
            //     console.log(i);
            //     console.log(domEle);
            // })
            $.each({
                name:'andy',
                age:18
            },function(i,ele){
                console.log(i);
                console.log(ele);
            })
        })
    </script>
</body>
</html>